package edu.pitt.cs.cs2410pj2.datamodel;

public class MessageType {
	public static int TRACEMSG = 1;// A trace message
	public static int WRITEMISS = 2;
	public static int READMISS = 3;
	public static int WRITHIT = 4;
	public static int INVALIDATE = 5;
	public static int BLOCKFETCH = 6;
	public static int BLOCKREPLY = 7;
	public static int DATAWRITEBACK = 8;
	public static int L2LOAD = 9;// Special Type, for loading data from memory
									// to L2
	public static int TILEREPLY = 10;
	public static int LISTREPLY = 11;
	public static int CHANGESTATE = 12;
	public static int SHAREBLOCKREPLY = 13;
	public static int ACKNOWLEDGEMENT = 14;
	public static int REDOREQ = 15;// the data block has been replaced
	public static int INVALIDATEFROMLRU = 16; // L2 block being replaced, does
												// not need an reply
												// acknowledgement

	public static String getTypeName(int type) {
		if (type == TRACEMSG) {
			return "TRACE MESSAGE";
		} else if (type == WRITEMISS) {
			return "WRITE MISS";
		} else if (type == READMISS) {
			return "READ MISS";
		} else if (type == WRITHIT) {
			return "WRITE HIT";
		} else if (type == INVALIDATE) {
			return "INVALIDATE";
		} else if (type == BLOCKFETCH) {
			return "BLOCKFETCH";
		} else if (type == BLOCKREPLY) {
			return "BLOCKREPLY";
		} else if (type == DATAWRITEBACK) {
			return "DATAWRITEBACK";
		} else if (type == L2LOAD) {
			return "L2LOAD";
		} else if (type == TILEREPLY) {
			return "TILEREPLY";
		} else if (type == LISTREPLY) {
			return "LISTREPLY";
		} else if (type == CHANGESTATE) {
			return "CHANGESTATE";
		} else if (type == SHAREBLOCKREPLY) {
			return "SHAREBLOCKREPLY";
		} else if (type == ACKNOWLEDGEMENT) {
			return "ACK";
		} else if (type == REDOREQ) {
			return "REDO";
		} else if (type == INVALIDATEFROMLRU) {
			return "INVALIDATEFROMLRU";
		}

		return "EXCEPTION THAT COULD NOT POSSIBLY HAPPEN";
	}
}
